﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;


class VerisonInAction
{
    [Version("1.0 by PeshoML", "Just Prints Numbers from 1 to 10")]
    public static void  PrintSomeNumbers()
    {
        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine(i);
        }
    }

    [Version("2.1 by PeshoML", "Prints Prime Numbers in range 1 to 9")]
    public static void PrintPrimes()
    {
        Console.WriteLine(2);
        Console.WriteLine(3);
        Console.WriteLine(5);
        Console.WriteLine(7);
    }

    public static void Main()
    {
        Type type = typeof(VerisonInAction);
        object[] allAttributes = type.GetMethods();

        foreach (var item in allAttributes)
        {
            MethodInfo mi = (MethodInfo)item;
         
           // Console.WriteLine(  mi.Name); 

            foreach (var v in mi.GetCustomAttributes(false))
            {
                if (v is VersionAttribute)
                {
                    VersionAttribute va = (VersionAttribute)v;
                    Console.WriteLine(va.VersionName + " " + va.OptionalInfo);
                }               
            }


            //Console.WriteLine("The version of the method is {0}, additional info {1}", va.VersionName,va.OptionalInfo);
        }

    }

}

